Event.Form.Inputs(FID).RestoreOption(KeyValue[,IsKey])
The .RestoreOption(KeyValue[, IsKey]) method restores removed options to the list of options for a combo box (pick list). This only allows restoration of removed options, not the addition of new options to the list. This function only works on combo box (pick list) fields. All other fields will return a scripting error.
Note: You can view the full list of options by right-clicking on the caption text and clicking on the Options note field to pull up the list of options. The list is in the following format [Display Text] - [Index (Value)].
Applies To
Properties and Methods
None
Available
The .RestoreOption(KeyValue[, IsKey]) method is available in:
- 16.07.007
- 17.00.004
- All newer builds
Note: The .RestoreOption(KeyValue[, IsKey]) method and all sub-classes, properties, and methods are only available in Form Layout scripts.
Type
Method
Syntax
Event.Form.Inputs(FID).RestoreOption(KeyValue[, IsKey]);
Parameters
|
Parameter |
Required |
Description |
|---|---|---|
|
KeyValue |
Yes |
A string that is either the Display Text of the option, or the Index Value |
|
IsKey |
No |
Boolean. If the KeyValue is the Index Value, then this must be set to true. Defaults to false is not present. |
Example
//--Add this script to the NewOrd1 form layout
//--Script to remove the 'SO Engineering' from the list of order types
var lpType = Event.Form.Inputs('Input_eTORD_to_ordtype');
var laType = lpType.Options;
var lcType = lpType.Options.join(', ');
Event.Form.YesNo('Order Type Options: ' + lcType); //--Note SO Engineering is there
//--Remove SO Engineering using option display text
lpType.RemoveOption('SO Engineering');
lcType = lpType.Options.join(', ');
Event.Form.YesNo('Order Type Options: ' + lcType); //--Note SO Engineering is NOT there
//--Restore So Engineering using index value
lpType.RestoreOption('e', true);
lcType = lpType.Options.join(', ');
Event.Form.YesNo('Order Type Options: ' + lcType); //--Note SO Engineering is there
/*Expected Prompt response:
Order Type Options: Complaint, SO Engineering, Forecast,
Credit Hold, Block Order, Inter-Company Transfer, Pricing
Order / Bill-To, Quote, Drop Shipment, Sales Order, Order
Template, Master Order, Cross-Facility, Pricing Order / Ship-
To
Yes No
Order Type Options: Complaint, Forecast, Credit Hold,
Block Order, Inter-Company Transfer, Pricing Order / Bill-To,
Quote, Drop Shipment, Sales Order, Order Template, Master
Order, Cross-Facility, Pricing Order / Ship-To
Yes No
Order Type Options: Complaint, SO Engineering, Forecast,
Credit Hold, Block Order, Inter-Company Transfer, Pricing
Order / Bill-To, Quote, Drop Shipment, Sales Order, Order
Template, Master Order, Cross-Facility, Pricing Order / Ship-
To
Yes No
*/